import request from '@/util/request'
import { useUserInfo } from "@/store/user.js";
const userInfoState = useUserInfo();

export function shoppingCartAll() {
    return request({
        url: '/shopping/cart/all',
        method: 'get',
    })
}

export function shoppingCartDel(shoppingCartIds) {
    return request({
        url: '/shopping/cart/del',
        method: 'delete',
        data: shoppingCartIds
    })
}

export function shoppingCartUpdateNumber(shoppingCartId, number) {
    return request({
        url: '/shopping/cart/update/number',
        method: 'put',
        data: {
            shoppingCartId: shoppingCartId,
            number: number
        }
    })
}

export function shoppingCartAdd(commodityId, number) {
    return request({
        url: '/shopping/cart/add',
        method: 'post',
        data: {
            commodityId: commodityId,
            number: number
        }
    })
}

export function selectShoppingCartsByIds(ids) {
    return request({
        url: '/shopping/cart/ids',
        method: 'post',
        data: ids
    })
}

export function selectShoppingCartSize() {
    return request({
        url: '/shopping/cart/size',
        method: 'get'
    })
}